﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Entities;
using DataObjects.EFData;

namespace DataObjects
{
    public static class ConvertDAO
    {
        public static ConfigInfo ToConfigInfo(this TB_Configuration tb_config)
        {
            return new ConfigInfo()
            {
                ConfigurationId = tb_config.ConfigurationID,
                Name = tb_config.Name,
                Value = tb_config.Value,
                IsEncrypted = tb_config.IsEncrypted,
                IsSystem = tb_config.IsSystem,
                ModifiedBy = tb_config.ModifiedBy,
                ModifyDate = tb_config.ModifyDate,
                Description = tb_config.Description
            };
        }
        public static TB_Configuration ToTB_Configuration(this ConfigInfo configInfo)
        {
            return new TB_Configuration()
            {
                ConfigurationID = configInfo.ConfigurationId,
                Name = configInfo.Name,
                Value = configInfo.Value,
                IsEncrypted = configInfo.IsEncrypted,
                IsSystem = configInfo.IsSystem,
                ModifiedBy = configInfo.ModifiedBy,
                ModifyDate = configInfo.ModifyDate,
                Description = configInfo.Description
            };
        }
        public static TB_MyCompany ToTB_MyCompany(this MyCompanyInfo myCompanyInfo)
        {
            return new TB_MyCompany()
            {
                CompanyId = myCompanyInfo.CompanyId,
                CompanyName = myCompanyInfo.CompanyName,
                Address = myCompanyInfo.Address,
                CreateDate = myCompanyInfo.CreateDate,
                CreatedBy = myCompanyInfo.CreatedBy,
                Description = myCompanyInfo.Description,
                Email = myCompanyInfo.Email,
                Fax = myCompanyInfo.Fax,
                Image = myCompanyInfo.Image,
                Phone = myCompanyInfo.Phone
            };
        }
        public static MyCompanyInfo ToMyCompanyInfo(this TB_MyCompany tb_MyCompany)
        {
            return new MyCompanyInfo()
            {
                CompanyId = tb_MyCompany.CompanyId,
                Address = tb_MyCompany.Address,
                CompanyName = tb_MyCompany.CompanyName,
                Description = tb_MyCompany.Description,
                Fax = tb_MyCompany.Fax,
                Email = tb_MyCompany.Email,
                Image = tb_MyCompany.Image,
                Phone = tb_MyCompany.Phone,
                CreateDate = tb_MyCompany.CreateDate,
                CreatedBy = tb_MyCompany.CreatedBy
            };
        }
        public static TB_MyBranches ToTB_MyBranches(this MyBranchesInfo myBranchesInfo)
        {
            return new TB_MyBranches()
            {
                ID = myBranchesInfo.Id,
                Address = myBranchesInfo.Address,
                BranchName = myBranchesInfo.BranchName,
                Description = myBranchesInfo.Description,
                Email = myBranchesInfo.Email,
                Fax = myBranchesInfo.Fax,
                IsHeadQuarter = myBranchesInfo.IsHeadQuarter,
                Phone = myBranchesInfo.Phone,
                CompanyId = myBranchesInfo.CompanyId
            };
        }
        public static MyBranchesInfo ToMyBranchesInfo(this TB_MyBranches tb_MyBranches)
        {
            return new MyBranchesInfo()
            {
                Id = tb_MyBranches.ID,
                Address = tb_MyBranches.Address,
                BranchName = tb_MyBranches.BranchName,
                CompanyId = tb_MyBranches.CompanyId,
                Description = tb_MyBranches.Description,
                Email = tb_MyBranches.Email,
                Fax = tb_MyBranches.Fax,
                IsHeadQuarter = tb_MyBranches.IsHeadQuarter,
                Phone = tb_MyBranches.Phone
            };
        }
        public static TB_FeedBack ToTB_FeedBack(this FeedBackInfo feedBackInfo)
        {
            return new TB_FeedBack()
            {
               FeedBackId=feedBackInfo.Id,
               Content=feedBackInfo.Content,
               CreateDate=feedBackInfo.CreateDate,
               Email=feedBackInfo.Email,
               IsNew=feedBackInfo.IsNew,
               OwnerName=feedBackInfo.OwnerName,
               Type=feedBackInfo.Type
            };
        }
        public static FeedBackInfo ToFeedBackInfo(this TB_FeedBack tb_FeedBack)
        {
            return new FeedBackInfo()
            {
                Id = tb_FeedBack.FeedBackId,
                Content = tb_FeedBack.Content,
                CreateDate = tb_FeedBack.CreateDate,
                Email = tb_FeedBack.Email,
                IsNew = tb_FeedBack.IsNew,
                OwnerName = tb_FeedBack.OwnerName,
                Type = tb_FeedBack.Type
            };
        }
        public static TB_UserProfile ToTB_UserProfile(this UserProfileInfo userProfileInfo)
        {
            return new TB_UserProfile()
            {
                BillToAddress1 = userProfileInfo.BillToAddress1,
                BillToAddress2 = userProfileInfo.BillToAddress2,
                BillToCity = userProfileInfo.BillToCity,
                BillToContact = userProfileInfo.BillToContact,
                BillToCountry = userProfileInfo.BillToCountry,
                BillToZip = userProfileInfo.BillToZip,
                CompanyName = userProfileInfo.CompanyName,
                CreateDate = userProfileInfo.CreateDate,
                Description = userProfileInfo.Description,
                Email = userProfileInfo.Email,
                Fax = userProfileInfo.Fax,
                FirstName = userProfileInfo.FirstName,
                FullName = userProfileInfo.FullName,
                ImageAvatar = userProfileInfo.ImageAvatar,
                LastName = userProfileInfo.LastName,
                Phone = userProfileInfo.Phone,
                Sex = userProfileInfo.Sex,
                TaxId = userProfileInfo.TaxId,
                Title = userProfileInfo.Title,
                UserId = userProfileInfo.UserId
            };
        }
        public static UserProfileInfo ToUserProfileInfo(this TB_UserProfile tb_UserProfile)
        {
            return new UserProfileInfo()
            {
                BillToAddress1 = tb_UserProfile.BillToAddress1,
                BillToAddress2 = tb_UserProfile.BillToAddress2,
                BillToCity = tb_UserProfile.BillToCity,
                BillToContact = tb_UserProfile.BillToContact,
                BillToCountry = tb_UserProfile.BillToCountry,
                BillToZip = tb_UserProfile.BillToZip,
                CompanyName = tb_UserProfile.CompanyName,
                CreateDate = tb_UserProfile.CreateDate,
                Description = tb_UserProfile.Description,
                Email = tb_UserProfile.Email,
                Fax = tb_UserProfile.Fax,
                FirstName = tb_UserProfile.FirstName,
                FullName = tb_UserProfile.FullName,
                ImageAvatar = tb_UserProfile.ImageAvatar,
                LastName = tb_UserProfile.LastName,
                Phone = tb_UserProfile.Phone,
                Sex = tb_UserProfile.Sex,
                TaxId = tb_UserProfile.TaxId,
                Title = tb_UserProfile.Title,
                UserId = tb_UserProfile.UserId
            };
        }
        public static TB_Message ToTB_Message(this MessageInfo messageInfo)
        {
            return new TB_Message()
            {
                MessageId = messageInfo.MessageId,
                Content = messageInfo.Content,
                CreateDate = messageInfo.CreateDate,
                From = messageInfo.From,
                IsDeletedByReceiver = messageInfo.IsDeletedByReceiver,
                HideToReceiver=messageInfo.HideToReceiver,
                IsNew = messageInfo.IsNew,
                Title = messageInfo.Title,
                To = messageInfo.To,
                
                
            };
        }
        public static MessageInfo ToMessageInfo(this TB_Message tb_Message)
        {
            return new MessageInfo()
            {
                MessageId = tb_Message.MessageId,
                Content = tb_Message.Content,
                CreateDate = tb_Message.CreateDate,
                From = tb_Message.From,
                IsDeletedByReceiver = tb_Message.IsDeletedByReceiver,
                HideToReceiver=tb_Message.HideToReceiver,
                IsNew = tb_Message.IsNew,
                Title = tb_Message.Title,
                To = tb_Message.To
            };
        }
        public static TB_Account ToTB_Account(this AccountInfo accountInfo)
        {
            return new TB_Account()
            {
                UserId = accountInfo.Id,
                CreateDate = accountInfo.CreateDate,
                FailedPasswordAttempCount = accountInfo.FailedPasswordAttempCount,
                IsActivated = accountInfo.IsActivated,
                IsLockedOut = accountInfo.IsLockedOut,
                LastLockoutDate = accountInfo.LastLockoutDate,
                LastLoginDate = accountInfo.LastLoginDate,
                LastPasswrodChangedDate = accountInfo.LastPasswodChangedDate,
                Password = accountInfo.Password,
                SecretAnswer = accountInfo.SecretAnswer,
                SecretQuestion = accountInfo.SecretQuestion

            };
        }
        public static AccountInfo ToAccountInfo(this TB_Account tb_Account)
        {
            return new AccountInfo()
            {
                Id = tb_Account.UserId,
                CreateDate = tb_Account.CreateDate,
                FailedPasswordAttempCount = tb_Account.FailedPasswordAttempCount,
                IsActivated = tb_Account.IsActivated,
                IsLockedOut = tb_Account.IsLockedOut,
                LastLockoutDate = tb_Account.LastLockoutDate,
                LastLoginDate = tb_Account.LastLoginDate,
                LastPasswodChangedDate = tb_Account.LastPasswrodChangedDate,
                Password = tb_Account.Password,
                SecretAnswer = tb_Account.SecretAnswer,
                SecretQuestion = tb_Account.SecretQuestion
            };
        }
    }
}
